package morningcat.study.spring.starter2;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;

/**
 * XXX
 *
 * @author mengzhang6
 * @date 2018/11/20 12:18
 */
public class ApplicationContextUtils {

    public ApplicationContext getApplicationContextByServletContext(ServletContext servletContext) {
        ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
        return context;
    }

    public ApplicationContext getApplicationContextByServletContext2(ServletContext servletContext) {
        ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        return context;
    }
}
